<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title th:text="${session.title}">123</title>
    <link th:replace="common/header"/>
    <link rel="stylesheet" th:href="@{/css/ace-skins.min.css}"/>
    <link th:replace="common/tip"/>
</head>
<body class="navbar-fixed">
<div th:replace="common/top"></div>
<div class="container-fluid main_bg" id="main-container">
    <a id="menu-toggler" href="#"><span></span></a>
    <div th:replace="common/menu"></div>
    <div id="main-content" class="clearfix">
        <div id="page-content" class="clearfix">
            <div th:replace="common/title"></div>
            <h3 class="header smaller lighter blue"><em class="icon-eye-open"></em>我的球队</h3>
            <div class="row-fluid" th:if="${null == footClub}">
                <!--PAGE CONTENT BEGINS HERE-->
                <div class="span12">
                    <span th:text="'没有找到' + ${session.footUser.nike} + '的球队'">123</span>
                </div>
            </div>
            <div th:if="${null != footClub}">
                <div class="row-fluid">
                    <!--PAGE CONTENT BEGINS HERE-->
                    <div class="span7">
                        <div class="row-fluid">
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'球队名称:' + ${footClub.qdName}">123</div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'所属玩家:' + ${footClub.userName}">123</div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'城市:' + ${null == footClub.cs ? ' ' : footClub.cs}">
                                        123
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <!--PAGE CONTENT BEGINS HERE-->
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'成立时间:' + ${#dates.format(footClub.clsj,'yyyy年')}">
                                        123
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls"
                                         th:utext="'球队简介:' + ${null == footClub.qdjj ? '无' : footClub.qdjj}">123
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls"
                                         th:utext="'主要奖项:' + ${null  == footClub.zyjx ? '无' : footClub.zyjx}">123
                                    </div>
                                </div>
                            </div>
                        </div>
                        <h3 class="header smaller lighter blue"
                            th:utext="'<em class=icon-eye-open></em>' + ${footClub.sjbm} + '赛季联赛信息'">123</h3>
                        <div class="row-fluid">
                            <!--PAGE CONTENT BEGINS HERE-->
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'胜:' + ${footClub.s}">123</div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'平:' + ${footClub.p}">123</div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'负:' + ${footClub.f}">123</div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <!--PAGE CONTENT BEGINS HERE-->
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls"
                                         th:text="'胜率:' + ${#numbers.formatPercent(footClub.sl, 1, 0)}">
                                        123
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'进球:' + ${footClub.jq}">
                                        123
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'失球:' + ${footClub.sq}">
                                        123
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <!--PAGE CONTENT BEGINS HERE-->
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'净胜球:' + ${footClub.jsq}">
                                        123
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'积分:' + ${footClub.jf}">
                                        123
                                    </div>
                                </div>
                            </div>
                            <div class="span4">
                                <div class="control-group">
                                    <div class="controls" th:text="'赛季:' + ${footClub.sj}">
                                        123
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="span5">
                        <!--<div class="row-fluid">
                            <div class="span12">
                                <div class="control-group">
                                    <img th:src="@{'/' + ${footClub.logoUrl}}" src="" alt="" height="100px" th:if="${null != footClub.logoUrl}"/>
                                    <img th:src="@{/images/unknow_team.png}" src="" alt="" th:if="${null == footClub.logoUrl}"/>
                                </div>
                            </div>
                        </div>-->
                        <div class="row-fluid">
                            <div class="span12">
                                <div class="control-group">
                                    <img th:src="@{'/' + ${footClub.qcUrl}}" src="" alt="" height="100px"
                                         th:if="${null != footClub.qcUrl}"/>
                                    <img th:src="@{/images/unknown_qc.png}" src="" alt=""
                                         th:if="${null == footClub.qcUrl}"/>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <h3 class="header smaller lighter blue"><em class="icon-list"></em>球队球员</h3>
                <div th:if="${null == qyList}" th:text="'没有找到' + ${session.footUser.nike} + '的球员'">123</div>
                <div th:if="${null != qyList}">
                    <form class="form-horizontal" th:object="${footClubSearchForm}" method="post"
                          th:action="@{/hy/footClub/changePerson}" id="form" name="form">
                        <div class="row-fluid">
                            <div class="span12">
                                <table id="table_bug_report" class="table table-hover">
                                    <thead>
                                    <tr>
                                        <th class="center" style="width:60px;"><label>选择</label></th>
                                        <th style="width:40px;">位置</th>
                                        <th>球员名称</th>
                                        <th style="width:80px;">等级</th>
                                        <th class="hidden-480" style="width:110px;">国籍</th>
                                        <th class="hidden-480" style="width:254px;">所属俱乐部</th>
                                        <th class="hidden-480" style="width:40px;">年龄</th>
                                        <th class="hidden-480" style="width:40px;">评分</th>
                                        <th class="hidden-480" style="width:60px;">球员身价</th>
                                        <th class="hidden-480">球员状态</th>
                                        <th class="hidden-480">剩余场次</th>
                                        <th class="hidden-480">是否为主力球员</th>
                                        <th class="hidden-480">战斗力</th>
                                        <th class="hidden-480">战力等级</th>
                                        <th class="hidden-480">进球总数</th>
                                        <th class="hidden-480">助攻总数</th>
                                        <th class="hidden-480">MVP总数</th>
                                        <th style="width:40px;">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <tr th:each="t:${qyList}">
                                        <td class="center"><label><input type="checkbox" name="selectIds"
                                                                         th:value="${t.id + ':' + t.xycs + ':' + t.fupId}"/><span
                                                class="lbl">&nbsp;</span></label></td>
                                        <td><a th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}">
                                            <img alt="" src="" th:src="@{/images/foot/gk.png}"
                                                 th:if="${t.wzbm == 'GK'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/sw.png}"
                                                 th:if="${t.wzbm == 'SW'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/cb.png}"
                                                 th:if="${t.wzbm == 'CB'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/lb.png}"
                                                 th:if="${t.wzbm == 'LB'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/rb.png}"
                                                 th:if="${t.wzbm == 'RB'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/dmf.png}"
                                                 th:if="${t.wzbm == 'DMF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/cmf.png}"
                                                 th:if="${t.wzbm == 'CMF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/lmf.png}"
                                                 th:if="${t.wzbm == 'LMF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/rmf.png}"
                                                 th:if="${t.wzbm == 'RMF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/lwf.png}"
                                                 th:if="${t.wzbm == 'LWF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/rwf.png}"
                                                 th:if="${t.wzbm == 'RWF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/amf.png}"
                                                 th:if="${t.wzbm == 'AMF'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/ss.png}"
                                                 th:if="${t.wzbm == 'SS'}"/>
                                            <img alt="" src="" th:src="@{/images/foot/cf.png}"
                                                 th:if="${t.wzbm == 'CF'}"/>
                                        </a></td>
                                        <td th:if="${t.qydj == '顶级球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><span
                                                style="color: orange; font-weight: bold"
                                                th:text="${t.yw + (t.name == null ? '' : '(' + t.name + ')')}">123</span></a></td>
                                        <td th:if="${t.qydj == '顶级球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em></a></td>
                                        <td th:if="${t.qydj == '超级球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><span
                                                style="color: purple; font-weight: bold"
                                                th:text="${t.yw + (t.name == null ? '' : '(' + t.name + ')')}">123</span></a></td>
                                        <td th:if="${t.qydj == '超级球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em></a></td>
                                        <td th:if="${t.qydj == '洲际球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><span
                                                style="color: blue; font-weight: bold"
                                                th:text="${t.yw + (t.name == null ? '' : '(' + t.name + ')')}">123</span></a></td>
                                        <td th:if="${t.qydj == '洲际球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em></a></td>
                                        <td th:if="${t.qydj == '普通球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><span
                                                style="color: #9dfe5c; font-weight: bold"
                                                th:text="${t.yw + (t.name == null ? '' : '(' + t.name + ')')}">123</span></a></td>
                                        <td th:if="${t.qydj == '普通球星'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><em
                                                class="icon-star text-warning"></em><em
                                                class="icon-star text-warning"></em></a></td>
                                        <td th:if="${t.qydj == '大众/白人'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><span
                                                style="color: white; font-weight: bold"
                                                th:text="${t.yw + (t.name == null ? '' : '(' + t.name + ')')}">123</span></a></td>
                                        <td th:if="${t.qydj == '大众/白人'}"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"><em
                                                class="icon-star text-warning"></em></a></td>

                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}">
                                            <span th:if="${null != t.gjUrl}"><img th:src="@{'/' + ${t.gjUrl}}" src=""
                                                                                  alt="" style="max-height:20px;"><span
                                                    th:text="${t.gjName}">123</span></span>
                                            <span th:if="${null == t.gjUrl}"><img th:src="@{/images/unknow.png}" src=""
                                                                                  alt="" style="max-height:20px;"><span
                                                    th:text="${null == t.gjName ? '未知' : t.gjName}">123</span></span>
                                        </a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${t.jlbName}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${t.nl}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${t.pf}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${#numbers.formatDecimal(t.qysj, 0, 0)}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}">
                                            <img alt="" th:src="@{/images/foot/xy.png}" src="" style="height:20px;"
                                                 th:if="${t.xycs < 10}"/>
                                            <img alt="" th:src="@{/images/foot/gp.png}" src="" style="height:20px;"
                                                 th:if="${t.gpzt == 1}"/>
                                        </a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${t.xycs}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${t.main ? '是' : '否'}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}"
                                                th:text="${t.power}">123</a></td>
                                        <td class="hidden-480"><a
                                                th:href="@{/hy/footClub/see(id=${t.id}, clubId=${footClub.id})}">
                                            <span style="font-weight: bold; color: white;"
                                                  th:if="${t.upTimes == 1}">1级</span>
                                            <span style="font-weight: bold; color: #9dfe5c;" th:if="${t.upTimes == 2}">2级</span>
                                            <span style="font-weight: bold; color: blue;"
                                                  th:if="${t.upTimes == 3}">3级</span>
                                            <span style="font-weight: bold; color: purple;"
                                                  th:if="${t.upTimes == 4}">4级</span>
                                            <span style="font-weight: bold; color: orange;"
                                                  th:if="${t.upTimes == 5}">5级</span></a></td>
                                        <td class="hidden-480" th:text="${t.jq}">123</td>
                                        <td class="hidden-480" th:text="${t.zg}">123</td>
                                        <td class="hidden-480" th:text="${t.mvp}">123</td>
                                        <td>
                                            <div class="inline position-relative">
                                                <button class="btn btn-minier btn-primary dropdown-toggle"
                                                        data-toggle="dropdown">
                                                    <em class="icon-cog icon-only bigger-110"></em>
                                                </button>
                                                <ul class="dropdown-menu dropdown-icon-only dropdown-light pull-right dropdown-caret dropdown-close"
                                                    th:if="${(session.footUser.qx.text == '会员' || session.footUser.qx.text == 'VIP1' || session.footUser.qx.text == 'VIP2' || session.footUser.qx.text == 'VIP3') && (session.footUser.id == footClub.userId)}">
                                                    <li><a th:href="@{/hy/footXf/add(id=${t.id}, xycs=${t.xycs})}"
                                                           class="tooltip-success" data-rel="tooltip" title="解约"
                                                           data-placement="left">
                                                        <span class="red"><em class="icon-signout"></em></span></a>
                                                    </li>
                                                    <li><a th:href="@{/hy/footGp/add}" class="tooltip-success"
                                                           data-rel="tooltip" title="挂牌" data-placement="left">
                                                        <span class="red"><em class="icon-signout"></em></span></a>
                                                    </li>
                                                    <li th:if="${t.xycs < 10}">
                                                        <a href="javascript:void(0);"
                                                           th:onclick="'javascript:wantGoon(' + ${t.id} + ',' + ${t.xycs} + ')'"
                                                           class="tooltip-success" data-rel="tooltip" title="续约"
                                                           data-placement="left">
                                                            <span class="red"><em class="icon-signout"></em></span></a>
                                                    </li>
                                                    <li><a href="#"
                                                           th:onclick="'javascript:checkPerson(' + ${t.fupId} + ');'"
                                                           class="tooltip-success" data-rel="tooltip"
                                                           data-placement="left" th:title="${t.main ? '设为替补' : '设为主力'}">
                                                        <span class="red"><em class="icon-signout"></em></span></a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </td>
                                    </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </form>
                    <div class="row-fluid">
                        <div class="span6">
                            &nbsp;
                        </div>
                        <div class="span6"
                             th:text="'球队总身价为：' + ${#numbers.formatDecimal(sum, 0, 0)} + ' 球队总战斗力为：' + ${#numbers.formatDecimal(power, 0, 0)}">
                            123
                        </div>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="text-center span12">
                        <button class="btn btn-success" type="button" id="update" onclick="updatePerson();"><em
                                class="icon-upload"></em>确认升级
                        </button>
                        <button class="btn btn-info" type="button" id="change" onclick="changePerson();"><em
                                class="icon-exchange"></em>确认置换
                        </button>
                        <a class="btn" type="button" th:href="@{/hy/footClub/search}"><em class="icon-arrow-left"></em>返回</a>
                        <a class="btn" type="button" th:href="@{/index}"><em class="icon-arrow-left"></em>返回首页</a>
                    </div>
                </div>
            </div>
            <!--/#page-content-->
        </div>
        <div th:replace="common/skin :: skin"></div>
    </div><!--/#main-content-->
</div><!--/.fluid-container#main-container-->
<div th:replace="common/jsList"></div>
<input type="hidden" name="id" id="id" th:value="${footClub.id}">
<script type="text/javascript">
    function checkPerson(fupid) {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/hy/footClub/checkPerson",
            data: "fupid=" + fupid,
            success: function (data) {
                if (data.msg === 'ok') {
                    showTip('tip', '设置成功', 4000);
                    refreshPage();
                } else {
                    showTip('tip', '您的主力已经超过18个', 4000);
                }
            }
        });
    }

    function changePerson() {
        var chk = 0;
        var chkObjs = document.getElementsByName("selectIds");
        for (var i = 0; i < chkObjs.length; i++) {
            if (chkObjs[i].checked) {
                chk += 1;
            }
        }
        if (chk !== 5) {
            showTip('tip', '选择5个任意球员才能兑换新球员', 4000);
            return false;
        } else {
            $("#change").attr("disabled", "disabled");
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/hy/footClub/changePerson",
                data: $("#form").serialize(),
                success: function (data) {
                    if (data !== null) {
                        showTip('tip', '获得新球员' + data.yw + (data.name === null ? '' : '(' + data.name + ')'), 4000);
                    } else {
                        showTip('tip', '服务器开小差了，请重试', 4000);
                    }
                    window.setTimeout("refreshPage()", 4000);
                }
            });
        }
    }

    function refreshPage() {
        window.location.href = "/hy/footClub/view?id=" + $("#id").val();
    }

    function updatePerson() {
        var chk = 0;
        var chkObjs = document.getElementsByName("selectIds");
        for (var i = 0; i < chkObjs.length; i++) {
            if (chkObjs[i].checked) {
                chk += 1;
            }
        }
        if (chk !== 2) {
            showTip('tip', '选择2个相同球员才能升级球员', 4000);
            return false;
        } else {
            $("#update").attr("disabled", "disabled");
            $.ajax({
                type: "POST",
                dataType: "json",
                url: "/hy/footClub/updatePerson",
                data: $("#form").serialize(),
                success: function (data) {
                    if (data.msg === 'ok') {
                        showTip('tip', '升级球员成功', 4000);
                    } else {
                        showTip('tip', data.msg, 4000);
                    }
                    window.setTimeout("refreshPage()", 4000);
                }
            });
        }
    }

    function wantGoon(qyId, xycs) {
        $('#tipName').text('你确认续约吗？');
        $('#tipButton').click(function () {
            xy(qyId, xycs);
        });
        showDialog('layer');
    }

    function xy(qyId, xycs) {
        $.ajax({
            type: "POST",
            dataType: "json",
            url: "/hy/footXf/xy",
            data: "qyId=" + qyId + "&xycs=" + xycs,
            success: function (data) {
                if (data.msg === 'ok') {
                    showTip('tip', '续约成功', 4000);
                    window.setTimeout("window.location.reload()", 4000);
                } else {
                    showTip('tip', data.msg, 4000);
                }
            }
        });
    }
</script>
</body>
</html>
